feat: de-proxy locale access#3189
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #3189 +/- ##
==========================================
- Coverage 98.90% 98.90% -0.01%
==========================================
Files 897 898 +1
Lines 3103 3100 -3
Branches 556 572 +16
==========================================
- Hits 3069 3066 -3
Misses 30 30
Partials 4 4
🚀 New features to boost your workflow:
|
|
Should I push this PR forward (as a pre-step of #3748) or should I drop it in favor of #3748 (or its parts)? TLDR: This PR intends to do:
#3748 does the same just with |
|
|
Agreed, if there are ways to chunk the more mechanical changes into seperate PRs like this that make the final PR smaller, and it doesn't break the build, then go for it. |
c67f876 to
dc7cd28
Compare
✅ Deploy Preview for fakerjs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
dc7cd28 to
ca3d391
Compare
|
I consider splitting this PR into 3 smaller PRs.
This PR is theoretically ready for review, but I would like to fix/simplify some code outside of this PR to reduce the diff (complexity). |
|
Decision Needed Which of the three should we do?
|
Team Decision We go with option 2 for now. The internal API usage can be verbose, we can use tooling to make our lives easier if required. |
e201c61 to
ae37690
Compare
ae37690 to
82eb2f8
Compare
|
Ready for review. |
|
I just thought about the following:
|
|
I created an alternative to this PR: |
|
We will continue to use our See also: |

Second part of the standalone module function feature #2667
Fixes #3155
Requires #2838
Overview
Description
Instead of calling
this.faker.definitions.category.entry, we will now useresolveLocaleData(this.faker.fakerCore, 'category', 'entry').Please note that this will get simplified with the next PR as
this.faker.fakerCorewill get replaced with justfakerCore.This change makes the functions independent from the main faker instance, at least locale access wise.
That makes
resolveLocaleDatathe first effective "standalone module function", as it no longer needs faker, only the fakerCore is needed.As an additional benefit it also fixes #3155
Recreating the PR
(Partially outdated)
this\.faker\.definitions\.(\w+)\.(\w+)withassertLocaleData(this.faker.fakerCore.locale.$1?.$2, '$1.$2')insrc.Next Steps (Future PR)
The next step after this PR is converting the other methods to standalone module functions.
Current
Future